control
Class Simulation

java.lang.Object
  extended by control.Simulation

public class Simulation
extends java.lang.Object

This Class contains algorithms useful for simulation


Field Summary
private  Community community
           
private  java.util.Set<SimulatedBy> pairs
           
private  Service target
           
 
Constructor Summary
protected Simulation(Service target, Community community)
           
 
Method Summary
private  boolean checkSimulationOfNextState(CState cs, Action as, State nextTState)
          checks if there is a state of the community going with the selected action to another state that is in simulation with the next state of the target
private  boolean checkSimulationSet()
          controls if all records in simulation set are in simulation and if one of them isn't it is deleted
protected  void compositionViaSimulation()
          creates the final simulation set containing all pairs of states which are in simulation
protected  boolean contains(SimulatedBy sb)
          checks if the given pair of states is present in the simulation set
private  void createSimulationSet()
          creates an initial simulation set containing: - all pairs of final target state and final community state - all pairs of not final target state and community state
protected  java.util.Iterator<SimulatedBy> getSimulationSet()
          gets an iterator on the element of the simulation set
protected  boolean isEmpty()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pairs

private java.util.Set<SimulatedBy> pairs

target

private Service target

community

private Community community
Constructor Detail

Simulation

protected Simulation(Service target,
                     Community community)
Method Detail

compositionViaSimulation

protected void compositionViaSimulation()
creates the final simulation set containing all pairs of states which are in simulation


createSimulationSet

private void createSimulationSet()
creates an initial simulation set containing: - all pairs of final target state and final community state - all pairs of not final target state and community state


checkSimulationSet

private boolean checkSimulationSet()
controls if all records in simulation set are in simulation and if one of them isn't it is deleted

Returns:
boolean, true if there is a record that isn't in simulation and that has been removed from the simulation set; false otherwise

checkSimulationOfNextState

private boolean checkSimulationOfNextState(CState cs,
                                           Action as,
                                           State nextTState)
checks if there is a state of the community going with the selected action to another state that is in simulation with the next state of the target

Parameters:
cs - - list of states which represent a community state
as - - action
nextTState - - next target state
Returns:
boolean, true if there is a next state of the community in simulation with the next state of the target; false otherwise

contains

protected boolean contains(SimulatedBy sb)
checks if the given pair of states is present in the simulation set

Parameters:
sb - - element to check
Returns:
boolean true if the set contains sb, false otherwise

getSimulationSet

protected java.util.Iterator<SimulatedBy> getSimulationSet()
gets an iterator on the element of the simulation set

Returns:
Iterator on SimulatedBy element

isEmpty

protected boolean isEmpty()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object